﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Quartz;
using Quartz.Job;
using wrsm.battlenet;
using wrsm.client.exceptions;

namespace wrsm.client {

    /// <summary>
    /// Quartz Implementation of job, to cause Realm Status Monitor to hit battle.net for updates
    /// </summary>
    internal class RealmStatusUpdateJob : IJob {

        /// <summary>
        /// Tell Realm Status Monitor to hit battle.net for realm status updates
        /// </summary>
        /// <param name="context">Job Execution Context</param>
        public void Execute(IJobExecutionContext context) {
            try {
                Console.WriteLine("Requesting realm status updates from battle.net");
                Program.RealmStatusUpdateMonitor.UpdateRealmStatus();
                Console.WriteLine("Job completed normally");
            } catch (WrsmClientMonitoringException caught) {
                Console.WriteLine("Error Executing Job {0}", caught);
            }
        }

    }
}
